package com.beauty.dressing.module.main.fragment;

import android.support.v7.widget.LinearLayoutManager;

import com.beauty.dressing.R;
import com.beauty.dressing.common.base.BaseFragment;
import com.beauty.dressing.common.bean.BaseBean;
import com.beauty.dressing.common.bean.Video;
import com.beauty.dressing.common.utils.ResUtil;
import com.beauty.dressing.module.main.adapter.VideoInListAdapter;
import com.beauty.dressing.module.main.holder.VideoInListHolder;
import com.framework.library.haorefresh.HaoRecyclerView;
import com.xiaolanba.commonlib.fresco.FrescoUtil;

import java.util.ArrayList;
import java.util.List;

public class VideoInListFragment extends BaseFragment {
    private HaoRecyclerView mRecyclerView;
    private VideoInListHolder mHeaderHolder;
    private VideoInListAdapter mAdapter;
    @Override
    public void setContentView() {
        setContentView(R.layout.common_haorefresh_no_title);
    }

    @Override
    public void findView() {
        mRecyclerView = (HaoRecyclerView) findViewById(R.id.hao_recycleview);
        mRecyclerView.setBackgroundColor(ResUtil.getColor(R.color.content_bg));
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        mRecyclerView.setLayoutManager(linearLayoutManager);
        mRecyclerView.addOnScrollListener(FrescoUtil.getPauseOnScrollListener());
    }

    @Override
    public void initData() {
        mHeaderHolder = new VideoInListHolder(context,mInflater,mRecyclerView);
        mAdapter = new VideoInListAdapter(context);
        mAdapter.addHeaderView(mHeaderHolder.itemView);
        List<BaseBean> list = new ArrayList<>();
        for (int i=0;i<3;i++){
            list.add(new Video());
        }
        mAdapter.setChild(list);
        mRecyclerView.setAdapter(mAdapter);
        mHeaderHolder.bindForHeader(null);
    }
}
